package com.purengage.ipilih;

import android.app.Activity;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.Toast;

import android.view.View.OnClickListener;

public class KirimResponden extends Activity {
	ProgressBar progress;
	
	public class sendResponden extends AsyncTask<String, String, Boolean>{
		private ProgressDialog dialog = new ProgressDialog(KirimResponden.this);

		@Override
		protected Boolean doInBackground(String... params) {
			// TODO Auto-generated method stub
			//need api
			Log.d("send", "no API for :" + params[0]);
			return true;
		}
		@Override
		protected void onPostExecute(Boolean result) {
			progress.setVisibility(View.GONE);
			super.onPostExecute(result);
			if (!result)
				Toast.makeText(
						KirimResponden.this,
						"Tidak dapat menghubungi server, periksa setting internet anda",
						Toast.LENGTH_LONG).show();
		}
		
		@Override
		protected void onPreExecute() {
			// TODO Auto-generated method stub
			progress.setVisibility(View.VISIBLE);
			super.onPreExecute();
		}
		
		
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.activity_kirim_responden);
		Button kirim = (Button) findViewById(R.id.KirimResponden);
		progress = (ProgressBar) findViewById(R.id.statusProgress);
		progress.setVisibility(View.GONE);
		kirim.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				new sendResponden().execute("KirimResponden");
			}
		});
		
	
	}
	
}
